package com.eduran.test.model.logger;


import com.eduran.test.model.ConsoleWriter;
import com.eduran.test.model.LogWriter;

import javax.annotation.Resource;

public class Logger_028 {
    private ConsoleWriter consoleWriter;
    private LogWriter fileWriter;

    @Resource
    public void setConsoleWriter(ConsoleWriter writer) {
        this.consoleWriter = writer;
    }
    @Resource(name = "squirrel")
    public void setFileWriter(LogWriter fileWriter) {
        this.fileWriter = fileWriter;
    }


    public void writeFile(String text) {
        fileWriter.write(text);
    }


    public void writeConsole(String text) {
        if (consoleWriter != null)
            consoleWriter.write(text);
    }
}
